package hu.blok1.veilingsite.client.gui;

import hu.blok1.veilingsite.client.Veilingsite;
import hu.blok1.veilingsite.shared.User;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;

public class adminIndex {
	private VerticalPanel vp;
	private User user;

	public adminIndex(VerticalPanel a, Veilingsite vs) {
		vp = a;
		vp.clear();
		user = vs.getUser();
		if (user.isLoggedIn()) {

			Label lb = new Label("ADMIN index");
			HorizontalPanel horipanel = new HorizontalPanel();
			VerticalPanel vertpanel1 = new VerticalPanel();
			VerticalPanel vertpanel2 = new VerticalPanel();
			horipanel.add(vertpanel1);
			horipanel.add(vertpanel2);

			Label productData = new Label("Wijzig productgegevens");
			productData.addClickHandler(new ClickHandler() {
				@Override
				public void onClick(ClickEvent event) {
					History.newItem("adminProductStatus");
				}
			});

			vertpanel1.add(productData);

			Label userData = new Label("Wijzig gebruikergegevens");
			userData.addClickHandler(new ClickHandler() {
				@Override
				public void onClick(ClickEvent event) {
					History.newItem("adminUserStatus");
				}
			});

			vertpanel2.add(userData);

			vp.add(lb);
			vp.add(horipanel);
		} else {
			Window.alert("U moet aangemeld zijn om deze pagina te kunnen zien!");		
			History.newItem("login");
		}
	}
}
